cmake_minimum_required(VERSION 3.5)  
project(remote_control)  
  
# Find dependencies  
find_package(X11 REQUIRED)  
if(X11_FOUND)  
    message(STATUS "X11 found lib: ${X11_LIBRARIES}")
    message(STATUS "X11 found inc: ${X11_INCLUDE_DIRS}")
else()  
    message(FATAL_ERROR "X11 not found")
endif()
   
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")  

find_package(Xtst REQUIRED)
if(Xtst_FOUND)  
  message(STATUS "Xtst found lib: ${Xtst_LIBRARIES}")
  message(STATUS "Xtst found inc: ${Xtst_INCLUDE_DIRS}")
else()  
  message(FATAL_ERROR "Xtst not found")  
endif()


find_package(Threads REQUIRED)
if(CMAKE_THREAD_LIBS_INIT)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
endif()


include_directories(  
  include  
  ${X11_INCLUDE_DIRS}
  ${Xtst_INCLUDE_DIRS}
)
# add_executable(server src/server.cpp src/ini_parser.cpp)
# add_executable(client src/client.cpp src/ini_parser.cpp)

add_executable(server src/RemoteDesktopServer.cpp src/IniFileParser.cpp src/NetTools.cpp src/SignalWraper.cpp)
add_executable(client src/RemoteDesktopClient.cpp src/IniFileParser.cpp src/NetTools.cpp src/SignalWraper.cpp)


target_link_libraries(server ${X11_LIBRARIES} ${Xtst_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(client ${X11_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
